<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('考生成绩汇总列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label>身份证号码：</label>
                                <input type="text" name="idCardNumber"/>
                            </li>
                            <li>
                                <label>报考年份：</label>
                                <input type="text" name="years"/>
                            </li>
                            <li>
                                <label>准考证号：</label>
                                <input type="text" name="examId"/>
                            </li>
                            <li>
                                <label>报考科数：</label>
                                <input type="text" name="applicationCount"/>
                            </li>
                            <li>
                                <label>有成绩科数：</label>
                                <input type="text" name="scoreCount"/>
                            </li>
                            <li>
                                <label>未通过/弃考科数：</label>
                                <input type="text" name="failCount"/>
                            </li>

                            <li>
                                <label>平均成绩：</label>
                                <input type="text" name="averagescore"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:VSumApplicationResult:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:VSumApplicationResult:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:VSumApplicationResult:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:VSumApplicationResult:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:VSumApplicationResult:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:VSumApplicationResult:remove')}]];
        var prefix = ctx + "system/VSumApplicationResult";
        var datas = [[${@dict.getType('application_years')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "考生成绩汇总",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'name',
                    title: '姓名',
                    sortable: true
                },{
                        field: 'idCardNumber',
                        sortable: true,
                        title: '身份证号码',
                        formatter: function (value, row, index) {
                            return '<a href="javascript:void(0)" onclick="viewByIdCardNumber(\'' + row.idCardNumber + '\',\'' + row.examId + '\')">' + value + '</a>';
                        }
                    },
                {
                    field: 'years',
                    title: '报考年份',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'examId',
                    sortable: true,
                    title: '准考证号'
                },
                {
                    field: 'applicationCount',
                    title: '报考科数',
                    formatter: function(value, row, index) {
                        return '<a href="javascript:void(0)" onclick="applicationCountDetail(\'' + row.examId + '\')">' + value + '</a>';
                    }
                },
                {
                    field: 'scoreCount',
                    title: '有成绩科数',
                    formatter: function(value, row, index) {
                        return '<a href="javascript:void(0)" onclick="scoreCountDetail(\'' + row.examId + '\')">' + value + '</a>';
                    }
                },
                    {
                        field: 'failCount',
                        title: '未通过/弃考科数',
                        formatter: function(value, row, index) {
                            return '<a href="javascript:void(0)" onclick="failCountDetail(\'' + row.examId + '\')">' + value + '</a>';
                        }
                    },

                {
                    field: 'averagescore',
                    title: '平均成绩'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.name + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.name + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /*考试详细-所有*/
        function applicationCountDetail(examId) {
            var url = prefix + '/detail/' + examId +'/all_subject';
            $.modal.openTab("考试详细", url);
        }
        /*考试详细-通过*/
        function scoreCountDetail(examId) {
            var url = prefix + '/detail/' + examId +'/score_subject';;
            $.modal.openTab("考试详细", url);
        }
        /*考试详细-未通过*/
        function failCountDetail(examId) {
            var url = prefix + '/detail/' + examId +'/fail_subject';;
            $.modal.openTab("考试详细", url);
        }
        /*考试详细*/
        function viewByIdCardNumber(idCardNumber,examId) {
            var url = prefix + '/view/' + idCardNumber;
            $.modal.openTab("考生成绩信息汇总详情", url);
        }
    </script>
</body>
</html>